package com.pai4j.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

/**
 * 群聊加入方式枚举
 */
@Getter
@NoArgsConstructor
@AllArgsConstructor
public enum GroupJoinTypeEnum {

    ACTIVE_JOIN(1, "主动加入"),
    INVITED(2, "邀请加入"),
    SCAN_QR_CODE(3, "扫码加入"),
    ADMIN_ADD(4, "管理员添加"),
    CREATE_GROUP(5, "创建群聊"),
    APPROVED(6, "审批通过"),
    RECOMMENDED(7, "推荐加入");

    private Integer type;
    private String typeName;

    /**
     * 根据类型值获取枚举
     */
    public static GroupJoinTypeEnum getByType(Integer type) {
        for (GroupJoinTypeEnum typeEnum : values()) {
            if (typeEnum.getType().equals(type)) {
                return typeEnum;
            }
        }
        return null;
    }
}
